# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php8-pecl-gearman
_extname=gearman
pkgver=2.1.0
pkgrel=0
pkgdesc="PHP 8 wrapper to libgearman - PECL"
url="https://github.com/php/pecl-networking-gearman"
arch="all"
license="PHP-3.01"
depends="php8-pcntl"
makedepends="gearman-dev php8-dev"
#checkdepends="gearmand"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize8
	./configure \
		--prefix=/usr \
		--with-php-config=/usr/bin/php-config8
	make
}

check() {
	php8 -dextension=modules/$_extname.so --ri $_extname
	# Requires server running so REPORT_EXIT_STATUS=0
	local _modules=/usr/lib/php8/modules
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		TESTS=--show-diff SKIP_ONLINE_TESTS=1 \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$_modules/pcntl.so \
		-d extension=modules/$_extname.so"
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php8/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/$_extname.ini
}

sha512sums="78a3877ba2212777a1c8387ce14c0e2210f3141b9a6bb87507547f6e3f02dfc03387111e6ac84729dba8b1b9c0483ef1ba3c458480bc0f2e9d68dd49bd073ba6  php-pecl-gearman-2.1.0.tgz"
